/*  Copyright © 2009 Blake Hegerle -*- C++ -*- */

/*  This file is part of metal.
 
    Metal is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see
    <http://www.gnu.org/licenses/>.

*/

#include <iostream>

#include "io.h"
#include "identifier.h"
#include "expression.h"
#include "parameter.h"
#include "module.h"
#include "decl.h"

using namespace std;

using namespace metal;
using namespace metal::meta;

namespace {
  ident(x);
  ident(a1);
  ident(a2);
  ident(fact);
  ident(n);
  ident(pi);

  module<> test_mod("test_mod");
}

#define mod(x, ...) auto x = ( module<>(#x), __VA_ARGS__);

void module_tests() {
  cout << "module_tests" << endl;

  mod(my_module,
     
      x = decl<int>(param(int, a1)),
      x = decl<int>(param(int, a2)),
      x = def(param(int, a1)) ( a1 )
	
      );

  mod(my_fact,
	
      fact = decl<int>(param(int, n)),

      fact = def( param(int, n) ) 
      ( cond(n < 2, 1, n * fact(n - 1)) ),

      pi = def() ( 3.1415926535897932384626433832795 )

      );
}
